#
# Copyright (C) 2004-2009 National Institute of Advanced Industrial
# Science and Technology (AIST), Japan.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
IPROUTE_INC	:= @IPROUTE_INC@
TC_COMPAT	:= @TC_COMPAT@
TCLIB_DIR	:= $(DESTDIR)@TCLIB_DIR@

INSTALL		:= @INSTALL@
INSTALL_PROGRAM	:= @INSTALL_PROGRAM@
INSTALL_SCRIPT	:= @INSTALL_SCRIPT@
INSTALL_DATA	:= @INSTALL_DATA@

TARGET		:= q_psp.so
OBJS		:= q_psp.o
CFLAGS		:= -g -Wall -fPIC -I ../kernel $(IPROUTE_INC)

# for compat
ifeq ($(TC_COMPAT),yes)
OBJS		+= tc_compat.o
CFLAGS		+= -DUSE_COMPAT
endif
LDFLAGS		:= -shared

all:	$(TARGET)
$(TARGET):	$(OBJS)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS)
.c.o:
	$(CC) $(CFLAGS) -c -o $*.o $<

install:	$(TARGET)
	test -d $(TCLIB_DIR) || mkdir -p $(TCLIB_DIR)
	$(INSTALL_PROGRAM) $(TARGET) $(TCLIB_DIR)

clean:
	-rm -f *~ $(OBJS) $(TARGET)
